<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="requestInterFace.Handle.userHandle"%>
<%@ page import="xml.response.*"%>
<%@ page import="xml.root"%>
<%@ page import="util.print.printLogCat"%>
<%@ page import="org.sql.table.*"%>
<%@ page import="xml.var"%>
<%@ include file="../../util/paramPrint.jsp" %>
<%@ page trimDirectiveWhitespaces="true" %> 

<%
String name = request.getParameter("name");
String password = request.getParameter("password");
if(name!=null){
name=java.net.URLDecoder.decode(name,"UTF-8");
}
		userinfo user=new userinfo();
		user.addequwhile(user.Mapfield("User_ID"), "=", name).
		addequwhile(user.Mapfield("Login_Pwd"), "=",password);
		response res=new response();
		res.setAttribute_Name("UserLogin");
		user.Select();
		if(user.getUser_ID().equals(name)){
		session.setAttribute("User_ID",user.getUser_ID());
		session.setAttribute("User_Type",user.getUser_Type());
		session.setAttribute("UP_ID",user.getUP_ID());
			
			if(user.getUser_Type().equals("1")){
			res.put(user.Mapfield("UserLogin"),var.create().setName(user.Mapfield("UserLogin")).setValue("true"));
			res.put(user.Mapfield("Url"),var.create().setName(user.Mapfield("Url")).setValue(response.encodeURL(    "../main/mainFrame.jsp")));
			}else if(user.getUser_Type().equals("2")){
			res.put(user.Mapfield("UserLogin"),var.create().setName(user.Mapfield("UserLogin")).setValue("true"));
			res.put(user.Mapfield("Url"),var.create().setName(user.Mapfield("Url")).setValue(response.encodeURL(    "../main/salesFrame.jsp")));
			}else if(user.getUser_Type().equals("4")){
			res.put(user.Mapfield("UserLogin"),var.create().setName(user.Mapfield("UserLogin")).setValue("true"));
			res.put(user.Mapfield("Url"),var.create().setName(user.Mapfield("Url")).setValue(response.encodeURL(    "../main/deliverFrame.jsp")));
			}else if(user.getUser_Type().equals("3")){
			res.put(user.Mapfield("UserLogin"),var.create().setName(user.Mapfield("UserLogin")).setValue("false"));
			res.put(user.Mapfield("error"),var.create().setName(user.Mapfield("sessionid")).setValue("客户不可登录"));
			}
		}else{
			res.put(user.Mapfield("UserLogin"),var.create().setName(user.Mapfield("UserLogin")).setValue("false"));
			res.put(user.Mapfield("error"),var.create().setName(user.Mapfield("error")).setValue("用户"+name+"不存在或密码错误!"));
		}
		root root=new root();
		root.addResponse(res);
		String rep=root.getXmlString();
%>
<%=rep%>
